package cn.zwx.strategy.pattern.example.basic;

import javax.annotation.PostConstruct;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @projectName:strategy-pattern-example
 * @see:cn.zwx.strategy.pattern.example.basic
 * @author:zhangwenxue
 * @createTime:2022/2/11 10:19
 * @version:1.0
 */
public interface GrantTypeStrategy {

    Map<String,GrantTypeStrategy> GRANT_TYPE_STRATEGY_MAP = new ConcurrentHashMap<>(8);

    /**
     *  初始化方法
     * @author zhangwenxue
     * @createTime 2022/2/11 10:21
     **/
    @PostConstruct
    default void init(){
        GRANT_TYPE_STRATEGY_MAP.put(getGrantType(),this);
    }

    /**
     *  获取优惠券类型
     * @return java.lang.String
     * @author zhangwenxue
     * @createTime 2022/2/11 10:22
     **/
    String getGrantType();


    /**
     *  查询方法
     * @return java.lang.String
     * @author zhangwenxue
     * @createTime 2022/2/11 10:24
     **/
    String query();
}
